/*     */ package com.zimbra.cs.mailbox.calendar;
/*     */ 
/*     */ import com.zimbra.common.calendar.ICalTimeZone;
/*     */ import com.zimbra.common.calendar.ICalTimeZone.SimpleOnset;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class WindowsTimeZoneInformation
/*     */ {
/*     */   private String mName;
/*     */   private String mStandardName;
/*     */   private String mDaylightName;
/*     */   private int mBiasMins;
/*     */   private WindowsSystemTime mStandardDate;
/*     */   private int mStandardBiasMins;
/*     */   private WindowsSystemTime mDaylightDate;
/*     */   private int mDaylightBiasMins;
/*     */   private int mStandardOffsetMillis;
/*     */   private int mDaylightOffsetMillis;
/*     */   
/*     */   public WindowsTimeZoneInformation(String name, int biasMins, WindowsSystemTime standardDate, int standardBiasMins, String standardName, WindowsSystemTime daylightDate, int daylightBiasMins, String daylightName)
/*     */   {
/*  55 */     this.mName = name;
/*  56 */     this.mBiasMins = biasMins;
/*  57 */     this.mStandardDate = standardDate;
/*  58 */     this.mStandardBiasMins = standardBiasMins;
/*  59 */     this.mDaylightDate = daylightDate;
/*  60 */     this.mDaylightBiasMins = daylightBiasMins;
/*     */     
/*  62 */     this.mStandardOffsetMillis = (-1 * (this.mBiasMins + this.mStandardBiasMins) * 60 * 1000);
/*  63 */     this.mDaylightOffsetMillis = (-1 * (this.mBiasMins + this.mDaylightBiasMins) * 60 * 1000);
/*     */     
/*  65 */     this.mStandardName = standardName;
/*  66 */     this.mDaylightName = daylightName;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   public String getName()
/*     */   {
/*  78 */     return this.mName;
/*     */   }
/*     */   
/*  81 */   public long getBiasMins() { return this.mBiasMins; }
/*  82 */   public WindowsSystemTime getStandardDate() { return this.mStandardDate; }
/*  83 */   public int getStandardBiasMins() { return this.mStandardBiasMins; }
/*  84 */   public int getStandardOffset() { return this.mStandardOffsetMillis; }
/*  85 */   public String getStandardName() { return this.mStandardName; }
/*  86 */   public WindowsSystemTime getDaylightDate() { return this.mDaylightDate; }
/*  87 */   public int getDaylightBiasMins() { return this.mDaylightBiasMins; }
/*  88 */   public int getDaylightOffset() { return this.mDaylightOffsetMillis; }
/*  89 */   public String getDaylightName() { return this.mDaylightName; }
/*     */   
/*     */   public String toString() {
/*  92 */     StringBuilder sb = new StringBuilder();
/*  93 */     sb.append("TIME_ZONE_INFORMATION {\n");
/*  94 */     sb.append("    Zone Name    = ").append(this.mName).append("\n");
/*  95 */     sb.append("    Bias         = ").append(this.mBiasMins).append("\n");
/*  96 */     sb.append("    StandardDate = ").append(this.mStandardDate).append("\n");
/*  97 */     sb.append("    StandardBias = ").append(this.mStandardBiasMins).append("\n");
/*  98 */     sb.append("    StandardName = ").append(this.mStandardName).append("\n");
/*  99 */     sb.append("    DaylightDate = ").append(this.mDaylightDate).append("\n");
/* 100 */     sb.append("    DaylightBias = ").append(this.mDaylightBiasMins).append("\n");
/* 101 */     sb.append("    DaylightName = ").append(this.mDaylightName).append("\n");
/* 102 */     sb.append("}");
/* 103 */     return sb.toString();
/*     */   }
/*     */   
/*     */   public ICalTimeZone toICal() {
/* 107 */     ICalTimeZone.SimpleOnset standardOnset = null;
/* 108 */     if (this.mStandardDate != null)
/* 109 */       standardOnset = this.mStandardDate.toSimpleOnset();
/* 110 */     ICalTimeZone.SimpleOnset daylightOnset = null;
/* 111 */     if (this.mDaylightDate != null) {
/* 112 */       daylightOnset = this.mDaylightDate.toSimpleOnset();
/*     */     }
/* 114 */     return ICalTimeZone.lookup(this.mName, this.mStandardOffsetMillis, standardOnset, this.mStandardName, this.mDaylightOffsetMillis, daylightOnset, this.mDaylightName);
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   public static WindowsTimeZoneInformation fromICal(ICalTimeZone icalTz)
/*     */   {
/* 125 */     WindowsSystemTime standardDate = WindowsSystemTime.fromSimpleOnset(icalTz.getStandardOnset());
/*     */     
/* 127 */     WindowsSystemTime daylightDate = WindowsSystemTime.fromSimpleOnset(icalTz.getDaylightOnset());
/*     */     
/*     */ 
/*     */ 
/*     */ 
/* 132 */     int bias = -1 * icalTz.getStandardOffset();
/* 133 */     int daylightBias = -1 * icalTz.getDaylightOffset() - bias;
/* 134 */     return new WindowsTimeZoneInformation(icalTz.getID(), bias / 60 / 1000, standardDate, 0, icalTz.getStandardTzname(), daylightDate, daylightBias / 60 / 1000, icalTz.getDaylightTzname());
/*     */   }
/*     */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/mailbox/calendar/WindowsTimeZoneInformation.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */